package com.webex.ta.hydra.core.macro;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by Cisco WebEx.
 * User: vegaz
 * Date: 2010-9-14
 * Time: 17:00:44
 */
public class MacroRegistry {
    private static MacroRegistry instance;

    private Map<String, MacroDefinition> macros = new HashMap<String, MacroDefinition>();

    private MacroRegistry() {}

    public static MacroRegistry getInstance() {
        if (instance == null)
            instance = new MacroRegistry();
        return instance;
    }

    public void clear() {
        macros.clear();
    }

    public void register(MacroDefinition macro) {
        macros.put(macro.getName(), macro);
    }

    public MacroDefinition get(String name) {
        return macros.get(name);
    }
}
